package com.motiv.regbooth;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class RegboothServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {		
		resp.setContentType("application/json");
		PrintWriter out = resp.getWriter();
		
		String mode = req.getParameter("tag");
		if (mode.equalsIgnoreCase("firstname")) {
			out.print("{\"names\":[{\"name\":\"Jay\"},{\"name\":\"James\"}]}");
		} else if (mode.equalsIgnoreCase("lastname")) {
			out.print("{\"names\":[{\"name\":\"Schultz\"},{\"name\":\"Reed\"}]}");
		}		
		
		out.flush();
	}
}
